Hi! I have a trigger, that changes one enumeration attribute (from released to draft), what is working fine. My problem is, that I have to highlight that it has changed somehow.
Example: Object Text: Bla Status_Attribute:Released (now s.o. changes Object Text and the trigger fires and changes Status_Attribute to Draft) Object Text: Bla_Change Status_Attribute(set by trigger):Draft Is it possible to highlight the Status_Attribute (only in this Object) somehow?
With best regards,
PS: Here is my code:
string DXLCode2 = "
Trigger trg = current;
if (null trg) halt();
AttrDef ad = attrdef(trg);
if (null ad) halt(); // Error?
Object obj = object(trg);
if (null obj) halt(); // Error?
string Name = ad.name;
Module mod = module(trg);
// Trigger feuert auch im read mode, wenn
// man das Objekt doppelklickt, daher...
if(!isEdit(mod)&&!isShare(mod)) halt();
if(Name == \"Object Text\")
{
for ad in mod do
{
if(ad.object)
{
if(ad.description \"\" == \"Variant Status\")
{
string BB_Variant_name=ad.name;
if(obj.BB_Variant_name \"\" == \"Released\")
{
obj.BB_Variant_name = \"Draft\";
}
}
}
}
}
";
Trigger trg2;
bool TrigOK2 = true;
string ErrMess2 = checkDXL(DXLCode2);
if (!null ErrMess2)
{
print ErrMess2 "\n***********\n" DXLCode2 "**********\n"
TrigOK2 = false
}
string NameTrig2 = "PostEditTrigger"
string Prompt2 = "Delete trigger '" NameTrig2 "' ??"
if (!TrigOK2) Prompt2 = "Trigger code has errors.\n" Prompt2
if (confirm(Prompt2))
{
ErrMess = delete (NameTrig2, module->object->attribute, post, modify, 7);
}
if (TrigOK2 && confirm("Deploy trigger '" NameTrig2 "' ??"))
{
trg2 = trigger(NameTrig2, module->object->attribute, post, modify, 7, DXLCode2);
infoBox "Installation complete!";
}
Bjoern_Karpenstein - Tue Sep 22 07:27:03 EDT 2015 |
Re: Highlight an enumeration attribute cell (text or background) The only way I have found to do this is to populate another attribute using DXL. Obviously this doesn't scale well, but if you're only doing it for one or two attributes, it may be acceptable. Outline method:
It's long-winded if you try to do it rigorously, but I created a partial solution (designed to work on current object, so it should be easy to modify to run on an object trigger) some time ago. It creates a 'monitor' attribute (and associated type) automatically, and sets them according to changes in the attribute declared as variable STR_SUBJECT_ATTRIBUTE. Hope it helps - usual caveats about bespoke code; this is incomplete, not as rigorous as it should be, doesn't clean up the type/attr when no longer required, etc...
|
Re: Highlight an enumeration attribute cell (text or background) Wow. I posted that trigger template years ago, glad to see at least one person uses it. I had trouble following Richard's solution but his narrative is sound and I have no reason to suspect it won't work. Have another idea. Have a simple Attr-DXL, lets call that attribute "Highlighted", type "Enumerated" with two values "." and "HIGHLIGHTED". The "color" of "." is black, the color of "HIGHLIGHTED" is red.
At line 28 in your trigger code insert this:
A column that contains one of your "Variant Status" attributes can define its color to be based on the "Highlighted" attribute. Or, you could just also display the "Highlighted" attribute in your view. -Louie The basic idea here is that the attr-DXL will set its own result to "." only if it has no current value. The trigger will set it to Highlighted regardless and it won't matter if the attr-DXL is in the view (already calculated) or not displayed (not already calculated); a "Highlighted" value won't get overwritten by a period unless you close the module or refresh dxl attributes. Yes, it is OK to set an attr-DXL value from other code. |